home *** CD-ROM | disk | FTP | other *** search
- this.onEnterFrame = function()
- {
- onFall();
- this._x -= _hitomi.speed;
- if(_hitomi.hitTest(this._x,this._y - 30,true))
- {
- _hitomi.hp += random(15) + 15;
- delete this.onEnterFrame;
- play();
- }
- };
- init = function()
- {
- gravity = 4;
- time = getTimer();
- time /= 100;
- rot = random(21) - 10;
- _rotation = 0;
- floor = _parent.floor;
- bounce = 0.22;
- speedx = random(7) - 3;
- speedystart = 0;
- _init = true;
- };
- this.onFall = function()
- {
- if(!_init)
- {
- init();
- }
- timenow = getTimer();
- timenow /= 100;
- speedy = gravity * (timenow - time) + speedystart;
- this._x += speedx / 5;
- this._y += speedy / 5;
- if(this._y > floor)
- {
- this._y = floor;
- speedy *= - bounce;
- time = getTimer();
- time /= 100;
- rot *= -0.5;
- speedystart = speedy;
- }
- if(speedy < 1 && _Y + 2 > floor)
- {
- speedx = 0;
- this.onRotate = function()
- {
- if(_rotation % 360 > 180)
- {
- }
- if(Math.abs(_rotation) < 2)
- {
- delete this.onRotate;
- }
- };
- }
- onRotate();
- };
- if(!_init)
- {
- init();
- }
- stop();
-